import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import local_get from '@dfeidao/atom-web/local/get';
import fire_to from '@dfeidao/atom-web/msg/fire';
import javadsd from '@dfeidao/atom-web/msg/javadsd';
import msg_error from '@dfeidao/atom-web/msgbox/error';
import msg_success from '@dfeidao/atom-web/msgbox/success';
// import whoami from '@dfeidao/atom-web/msg/whoami';
import storage_get from '@dfeidao/atom-web/storage/get';
import a002 from "./a002";
// 初始化功能定义
export default async function a003(fd: IFeidaoAiBrowserComponent) {
	try {
		const client_type = local_get(fd, "client_type");
		// const user = await whoami();
		const prid = storage_get('productid');
		const condition = {
			param: {
				productid: prid,
				client_type
			}
		};
		const res = await javadsd<{ code: number }>('12', '11', 'feidao_devclouddsd0000021', condition);
		if (res.code === 1) {
			await a002(fd);
			msg_success("初始化成功");
			fire_to('zj-000001', 'a002');
		} else {
			msg_error("初始化失败");
		}
	} catch (e) {
		msg_error(e);
	}
}
